<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<!-- meta tags, link to css:  -->
	<%@ include file="../../jsp-includes/mymetaheader.jsp" %>
	
	<!--  Ajax-Includes -->
    <script type='text/javascript' src='<%= request.getContextPath()%>/dwr/interface/DWRUserManager.js'></script>
    <script type='text/javascript' src='<%= request.getContextPath()%>/dwr/interface/DWRSearchManager.js'></script>
    <script type='text/javascript' src='<%= request.getContextPath()%>/dwr/engine.js'></script>
    <script type='text/javascript' src='<%= request.getContextPath()%>/dwr/util.js'></script>
    <script src="<%= request.getContextPath()%>/scriptaculous/prototype.js" type="text/javascript"></script>
	<script src="<%= request.getContextPath()%>/scriptaculous/scriptaculous.js" type="text/javascript"></script>

	<title>
		GroupMe! - Export API
	</title>
	<script type="text/javascript" language="javascript"><!--
	//<![CDATA[//>


function init() {
  DWRUtil.useLoadingMessage();
}

	//<!]]>
	--></script>
</head>
<body onload="init();">
	<!-- title image, logo:  -->
	<div id="groupme_header">
		<%@ include file="../../jsp-includes/groupme_header.jsp" %>
	</div>
	
	<!-- Menu: -->
	<div id="menu">
		<%@ include file="../../jsp-includes/groupme_menu.jsp" %>
	</div>
	<!-- content and sidebar -->
	<!-- Content: -->
	<div id="mycontent">
		
			<div class="ro_bw">
				<div class="lo_bw">
					<div class="ru_bw">
						<div class="lu_bw">
							<div id="user_groups">
								<div class="content_header" id="grouplist_header" style="padding-top: 2px">
									<small style="color: #006699;">
									<span id="register_header">
										RESTful API
									</span> 
									</small>
								</div>
								
								<div class="generalContent" style="">
								<div id="personal-menu" style="padding-bottom: 1em;"><strong>APIs: 
											<a href="../" title="Overview">Overview</a> |
											 <a href="../rest/" title="RESTful API">RESTful API</a> |
											 <a href="../export/" title="Export API">Export API</a> |
											 <a href="../search/" title="Search API">Search API</a></strong>
								</div>
								<h2><a name="export" class="no-link">Export API</a></h2> 
                        
                        <p>
                            There are currently two export formats available: RDF and RSS. You can choose in which format the data should be exported by using
                            the <b>export-format</b> parameter. <br /><br />
                            Further options are listed below:
                        </p>
                            <h4><a name="export-arguments" class="no-link">Arguments</a></h4>
                            <ul style="line-height: 20px;">
                                <li>
                                    <b>tag</b><br style="display: inline" />The tag parameter specifies the keyword the searched resource (or group)
                                    is tagged with.<br />Multiple tags are possible, for example:<br />
                                    <div style="padding: 10px; font-size: 12px; width: 300px;">
                                        ...export.do?tag=hannover&amp;tag=rathaus
                                    </div>    
                                    By searching for a keyword, the parameter <b>mode</b> is required!<br /><br />
                                </li>
                                <li>
                                    <b>export-format</b> (optional)<br style="display: inline" />Currently there are two export formats available. If no
                                    format is submitted, the data will be exported in RDF.
                                    <ul style="margin-top: 4px;">
                                        <li><i>RDF</i>  (<a href="../rdf/groupme.owl" style="font-size: 12px;">GroupMe! ontology</a>)</li>
                                        <li><i>RSS</i>  (<a href="http://cyber.law.harvard.edu/rss/rss.html" style="font-size: 12px;">RSS 2.0 specification</a>)</li>
                                    </ul><br />
                                </li>
                                <li><b>mode</b><br style="display: inline" />This parameter declares what should be exported. Exporting groups
                                implies the export of resources in the respective group. However exporting resources only means the export of the keyword(s) tagged resources.
                                     <ul style="margin-top: 4px;">
                                        <li><i>export-groups</i></li>
                                        <li><i>export-resources</i></li>
                                    </ul> <br />                              
                                </li>
                                <!-- 
                                <li><b>search-mode</b> (optional)<br style="display: inline" />By searching for more than one keyword you can 
                                     specify whether the resource or group is tagged with only one of the submitted keywords or has to be tagged
                                     with all keywords.
                                     <ul style="margin-top: 4px;">
                                        <li><i>all-keywords</i></li>
                                        <li><i>one-keyword</i></li>                                        
                                    </ul><br />                                
                                    
                                <li><b>media-type</b> (optinal)<br style="display: inline" />
                                     <ul style="margin-top: 4px;">
                                        <li><i>image</i></li>
                                        <li><i>rss</i></li>
                                        <li><i>video</i></li>
                                        <li><i>audio</i></li>
                                        <li><i>website</i></li>
                                        <li><i>shockwave</i></li>
                                    </ul>      
                                </li>-->
                            </ul>
                            <h4><a name="export-example" class="no-link">Example answers</a></h4>
                        <div style="background-color: #f3f3f3; padding: 3px; font-size: 12px; width: 600px;">
                        	 <p>
                                <b>Query:</b></p>
                                <div style="margin-left: 10px; margin-top: 5px;">
                                    <a href="http://groupme.org/api/export.do?tag=hannover&amp;mode=export-groups&amp;export-format=rdf">
                                        http://groupme.org/api/export.do?tag=hannover&amp;mode=export-groups&amp;export-format=rdf
                                    </a>
                                </div>
                       </div>
                        
                        <p> The answer shown below in RSS:</p>
                            <table class="api-example">
                                <tr>
                                    <td>
                                        <pre>
                                            
  &lt;channel>
    &lt;title>search-result&lt;/title&gt;
    &lt;description /&gt;
    &lt;dc:language>en&lt;/dc:language&gt;
    &lt;pubDate&gt;Tue, 10 Jul 2007 23:20:23 CEST&lt;/pubDate&gt;
    &lt;item&gt;
      &lt;title&gt;Hannover&lt;/title&gt;
      &lt;description&gt;Sightseeing stuff in Hannover&lt;/description&gt;
      &lt;category&gt;Hannover&lt;/category&gt;
      &lt;category&gt;rathaus&lt;/category&gt;
      &lt;category&gt;g&auml;rten&lt;/category&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;title&gt;Hannover&lt;/title&gt;
      &lt;description&gt;Hannover ist eine wundersch&ouml;ne Stadt.&lt;/description&gt;   
      &lt;category&gt;Hannover&lt;/category&gt;
    &lt;/item&gt;
  &lt;/channel&gt;
                                        </pre>  
                                    </td>
                                </tr>
                            </table>
                        <p> The answer shown below in RDF (truncated):</p> 
                            <table class="api-example">
                                <tr>
                                    <td>
                                        <pre>
                                            
  &lt;rdf:Description rdf:about="http://www.groupme.net/Resource#1173"&gt;
    &lt;groupme:hasTag rdf:resource="http://www.groupme.net/Tag#6"/&gt;
    &lt;groupme:hasResource rdf:resource="http://www.groupme.net/Resource#1175"/&gt;
    &lt;groupme:hasResource rdf:resource="http://www.groupme.net/Resource#1174"/&gt;
    &lt;groupme:resourceURL rdf:datatype="http://www.w3.org/2001/XMLSchema#string"&gt;
    &lt;/groupme:resourceURL&gt;
    &lt;dc:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string"&gt;
      Hannover ist eine wundersch&ouml;ne Stadt.
    &lt;/dc:description&gt;
    &lt;dc:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string"&gt;
      Hannover
    &lt;/dc:title&gt;
    &lt;rdf:type rdf:resource="http://groupme.net/rdf/#Group"/&gt;
  &lt;/rdf:Description&gt;
  &lt;rdf:Description rdf:about="http://www.groupme.net/Tag#6"&gt;
    &lt;groupme:isCorrelatedTo rdf:nodeID="A2"/&gt;
    &lt;groupme:isCorrelatedTo rdf:nodeID="A1"/&gt;
    &lt;groupme:isCorrelatedTo rdf:nodeID="A0"/&gt;
    &lt;dc:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string"/&gt;
    &lt;groupme:keyword rdf:datatype="http://www.w3.org/2001/XMLSchema#string"&gt;
      Hannover
    &lt;/groupme:keyword&gt;
    &lt;rdf:type rdf:resource="http://groupme.net/rdf/#Tag"/&gt;
  &lt;/rdf:Description&gt;
  ...
                                        </pre>  
                                    </td>
                                </tr>
                            </table>
                            

                            <div style="background: #f3f3f3; width: 600px;"> <h2><a name="client-api" class="no-link">Client api</a></h2> 
                            </div>
                            <br />
                            <p>
                            The client api is an easy way to use the possibilities of GroupMe! in your application. The example below show you 
                            how to get started. The Javadoc api can be found <a href="javadoc/">here</a>. <br />
                            To download the client api Jar file please click <a href="groupme-client-api.jar">here</a>.
                        </p>
                            
                        <h4><a name="api-example" class="no-link">Client example</a></h4>
                        <p>
                            The following example will show you how easy it is to use the GroupMe! api. Just create a collection
                            of keywords the group (or resource) should be tagged with (line 1 - 3). You only have to call the corresponding 
                            method with these keywords (line 4) and receive a collection of groups (or resources). 
                        </p>
                        <table class="api-example">
                                <tr>
                                    <td>
                                        <pre>
                                            
    // imports
    import org.groupme.action.GroupMeFactory;
    import org.groupme.model.Group;
    import org.groupme.model.Resource;
    ...

    // create a list of keywords the group(s) is (are) tagged with
(1) Collection&lt;String&gt; keywords = new ArrayList&lt;String&gt;();
(2) keywords.add("semantic web");
(3) keywords.add("Web 2.0");

    // get groups by these keywords
(4) Collection&lt;Group&gt; groupCollection = <b>GroupMeFactory.getGroupsByTags(keywords)</b>; 

    // get the name and resources of the first group
(5) Group firstGroup = groupCollection.iterator.next();
(6) String groupName = firstGroup.getName();
(7) Collection&lt;Resource&gt; resourceCollection = firstGroup.getGroups();
                                        </pre>  
                                    </td>
                                </tr>
                        </table>         
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		
	</div>
	
	<div id="footer">
		<%@ include file="../../jsp-includes/footer.jsp" %>
	</div>
</body>
</html>